<template>
  <div id="bigbox">
    <div class="boxa">
      <div class="box" v-for="(v, i) in arr" :key="i">
        <img :src="v.imgsrcc" alt="" />
        <p class="p1">{{ v.titll }}</p>
        <p class="wu">{{ v.text }}</p>
        <div class="boxc">
          <div>
            <span class="yuan">{{ v.fuhao }}</span
            ><span class="er">{{ v.price }}</span
            ><span
              ><del>{{ v.del }}</del></span
            >
          </div>
          <div class="yi">{{ v.num }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  computed: {
    arr() {
      return this.$store.state.list.arrt;
    },
  },
  created() {
    if (sessionStorage.getItem("store")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(sessionStorage.getItem("store"))
        )
      );
    }

    //在页面刷新时将vuex里的信息保存到sessionStorage里
    window.addEventListener("beforeunload", () => {
      sessionStorage.setItem("store", JSON.stringify(this.$store.state));
    });
  },
};
</script>

<style scoped>
#bigbox {
  width: 3.42rem;
  margin: 0 auto;
  /* background: lightseagreen; */
 
}
.boxa{
 display: flex;
 flex-wrap: wrap;
  justify-content: space-between;
}
.box {
  height: 2.79rem;
  width: 1.69rem;
  /* background: palegreen; */
 
}
.p1 {
  font-size: 0.16rem;
  font-weight: 400;
  margin-bottom: 0.1rem;
}
img {
  width: 1.68rem;
  height: 1.62rem;
}
.wu {
  /* font: 0.08rem;
  -webkit-transform: scale(0.833); */
  color: #a99463;
  font-size: 0.1rem;
  margin-bottom: 0.1rem;
}
.boxc {
  display: flex;
  justify-content: space-between;
}
.er {
  font-size: 0.2rem;
  font-weight: 600;
  color: #fb5a39;
}
.yuan {
  color: #fb5a39;
}
del {
  font-size: 0.12rem;
  color: rgb(160, 160, 160);
  padding-left: 0.1rem;
}
.yi {
  font-size: 0.1rem;
  line-height: 0.25rem;
  color: rgb(160, 160, 160);
}
</style>